package zhongbo.java.air.fightpath.web.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zhongbo.java.air.common.vo.PageVo;
import zhongbo.java.air.common.vo.ResultVo;
import zhongbo.java.air.fightpath.model.FlightPath;
import zhongbo.java.air.fightpath.service.IAirFightPathService;

/**
 * 说明：
 *
 * @author 钟波dellNotebook
 * @since 2025年04月01日 星期二 22:20:56
 */
@RestController
@RequestMapping("flightPath")
@Api(tags = "航迹数据接口")
public class FlightPathController {

    @Autowired
    private IAirFightPathService flightPathService;

    @PostMapping("add")
    @ApiOperation("添加")
    ResultVo<FlightPath> add(@RequestBody FlightPath entity) {
        FlightPath flightPath = flightPathService.add(entity);
        return ResultVo.ok(flightPath);
    }

    @GetMapping("delete")
    @ApiOperation("删除")
    ResultVo<String> delete(String entityId) {
        String delete = flightPathService.delete(entityId);
        return ResultVo.ok(delete);
    }

    @PostMapping("edit")
    @ApiOperation("修改")
    ResultVo<FlightPath> edit(@RequestBody FlightPath edit) {
        FlightPath flightPath = flightPathService.edit(edit);
        return ResultVo.ok(flightPath);
    }

    @GetMapping("findOne")
    @ApiOperation("查询一条")
    ResultVo<FlightPath> findOne(String entityId) {
        FlightPath flightPath = flightPathService.findOne(entityId);
        return ResultVo.ok(flightPath);
    }

    @GetMapping("findPage")
    @ApiOperation("分页查询列表")
    ResultVo<PageVo<FlightPath>> findPage(Integer page, Integer pageSize
            , String icao, String startTime, String endTime
            , String keyword, String fields
            , String oderByField, Boolean orderByAsc) {
        PageVo<FlightPath> pageVo = flightPathService.findPage(keyword, fields
                , icao, startTime, endTime
                ,page, pageSize, oderByField, orderByAsc);
        return ResultVo.ok(pageVo);
    }

}
